package com.milkTeaServer.dao;

import com.milkTeaServer.bean.Cart;
import com.milkTeaServer.bean.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CartDao extends JpaRepository<Cart,Integer> {
    @Modifying
    @Query(value="select id,userid, orderid from t_cart where userid = ?1 order by id desc",
            nativeQuery=true )
    List<Cart> findCartById(Integer id);
}
